<html>
<head><meta charset="utf-8"><title>Use `tracing` instead of `log` compiler-team#331 · t-compiler/major changes · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/index.html">t-compiler/major changes</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html">Use `tracing` instead of `log` compiler-team#331</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="203593171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203593171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203593171">(Jul 11 2020 at 11:46)</a>:</h4>
<p><code>tracing</code> is great. Recently we ported the code-base at my $DAYJOB and being able to just register a new subscriber such as <a href="https://docs.rs/tracing-tracy/0.1.2/tracing_tracy/">tracing-tracy</a> to quickly expose the codebase to a full blown profiling tool has proved to be super helpful. I don’t think there exists yet a subscriber that outputs traces in e.g. a format that measureme or chromium devtools/firefox profiler understand, but that's something that will inevitably happen.</p>
<p>That said, once we have some experience with tracing I suspect that we might want to port various ways to produce trace data (<code>-Zself-profile</code>) to tracing as well.</p>



<a name="203593174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203593174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203593174">(Jul 11 2020 at 11:46)</a>:</h4>
<p>@rustbot thirded ^^</p>



<a name="203599116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203599116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203599116">(Jul 11 2020 at 14:35)</a>:</h4>
<p>Do we have a plan for which subscriber to use? Cc <span class="user-mention" data-user-id="124288">@oli</span> </p>
<p>Step 2 looks like a lot of work too - maybe we don't need to make that replacement immediately and can do it as needed/wanted? It's not clear to me when a value is preferred over inclusion in the format string explicitly</p>



<a name="203603518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203603518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tshepang Lekhonkhobe <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203603518">(Jul 11 2020 at 16:26)</a>:</h4>
<p>how this issue is presented seems to suggest there was a discussion about this, because it does not say why tracing should be adopted</p>



<a name="203605805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203605805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203605805">(Jul 11 2020 at 17:30)</a>:</h4>
<p>There has been some discussion, most recently <a href="#narrow/stream/146212-t-compiler.2Fconst-eval/topic/anon_const_instance_printing/near/203584713">https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/anon_const_instance_printing/near/203584713</a> but also over in wg-traits at <a href="#narrow/stream/144729-wg-traits/topic/tracing-tree/near/203605486">https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/tracing-tree/near/203605486</a> and <a href="#narrow/stream/144729-wg-traits/topic/tracing.20in.20chalk/near/192424178">https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/tracing.20in.20chalk/near/192424178</a> (a bit older)</p>



<a name="203605818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203605818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203605818">(Jul 11 2020 at 17:31)</a>:</h4>
<p>To summarize the general idea of it:</p>



<a name="203605831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203605831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203605831">(Jul 11 2020 at 17:31)</a>:</h4>
<p>Tracing offers a lot of support for being able to capture <em>hierarchical</em> data</p>



<a name="203605881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203605881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203605881">(Jul 11 2020 at 17:32)</a>:</h4>
<p>In Chalk, this is super helpful if we consider that we trying recursively try to solve goals</p>



<a name="203605885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203605885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203605885">(Jul 11 2020 at 17:32)</a>:</h4>
<p>In rustc, this kind of patterns comes up a lot too</p>



<a name="203605966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203605966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203605966">(Jul 11 2020 at 17:35)</a>:</h4>
<p>But as <span class="user-mention" data-user-id="123586">@nagisa</span> said, tracing also offers a lot in terms of the subscribers that you can use</p>



<a name="203610742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203610742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203610742">(Jul 11 2020 at 19:49)</a>:</h4>
<p>One benefit of tracing is that with some subscribers you get an ability to combine events (e.g. log messages) and spans in a single unified infrastructure. I don’t know if <code>measureme</code> currently drains the log messages as events for exposition in those same chrome devtools, but its definitely something that I would find super useful if I ever needed to spelunk logs.</p>



<a name="203636490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203636490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203636490">(Jul 12 2020 at 09:51)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331/near/203599116">said</a>:</p>
<blockquote>
<p>Do we have a plan for which subscriber to use? Cc <span class="user-mention silent" data-user-id="124288">oli</span> </p>
</blockquote>
<p>Hmm... I was just gonna use the official <code>tracing_subscriber::fmt::Subscriber</code> with the env filter, which gives us the existing behaviour. Then we can fine tune it. Likely once we start using spans, we'll need to figure out something better, because otherwise each log message becomes <em>very</em> long</p>
<blockquote>
<p>Step 2 looks like a lot of work too - maybe we don't need to make that replacement immediately and can do it as needed/wanted? </p>
</blockquote>
<p>oh yea, definitely, I didn't mean that as a single enormous step, we can do this like when we moved to rustfmt by rustfmting a crate or module at a time. </p>
<blockquote>
<p>It's not clear to me when a value is preferred over inclusion in the format string explicitly</p>
</blockquote>
<p>basically whenever the format string contains <code>foo = {:?}</code> you'll definitely want value printing. With a custom filter we could make events with certain values influence logging (e.g. only start logging after a certain value has been hit), so if things are values you can actually use them for such filters</p>



<a name="203648314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203648314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203648314">(Jul 12 2020 at 15:35)</a>:</h4>
<p>hmm</p>



<a name="203648397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203648397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203648397">(Jul 12 2020 at 15:36)</a>:</h4>
<p>I'm still not quite sold on the value printing, to be honest -- it seems useful in theory, I guess, but I don't know that I'd want to rewrite existing code to use it (vs. doing so when we actually have use cases)</p>



<a name="203648457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203648457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203648457">(Jul 12 2020 at 15:38)</a>:</h4>
<p>to take a concrete example that I just randomly found, for <a href="https://github.com/rust-lang/rust/blob/e59b08e62ea691916d2f063cac5aab4634128022/src/librustc_parse/lexer/mod.rs#L125">https://github.com/rust-lang/rust/blob/e59b08e62ea691916d2f063cac5aab4634128022/src/librustc_parse/lexer/mod.rs#L125</a> -- it seems like it's not obvious that we want to pull those values out separately, because it makes reading the log possibly harder</p>



<a name="203650626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203650626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203650626">(Jul 12 2020 at 16:37)</a>:</h4>
<p>yea, that case doesn't look like a case we should change mechanically</p>



<a name="203650685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203650685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203650685">(Jul 12 2020 at 16:39)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/0c03aee8b81185d65b5821518661c30ecdb42de5/src/librustc_mir/transform/check_consts/validation.rs#L264">this</a> is a case I would change though</p>



<a name="203650978"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203650978" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203650978">(Jul 12 2020 at 16:46)</a>:</h4>
<p>hm okay -- maybe it makes sense to say a bit more about that in the proposal? I do think we might want something like a proc macro which to start would do the standard function and args logging and eventually maybe span-ify the function call</p>



<a name="203653520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203653520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203653520">(Jul 12 2020 at 17:49)</a>:</h4>
<p>That sounds awfully like the <code>#[instrument]</code> macro, if I understand you correctly</p>



<a name="203653678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203653678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203653678">(Jul 12 2020 at 17:53)</a>:</h4>
<p>hm, yes, that looks pretty close</p>



<a name="203653684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203653684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203653684">(Jul 12 2020 at 17:53)</a>:</h4>
<p>not sure if it gets 100% of the way there</p>



<a name="203653919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203653919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203653919">(Jul 12 2020 at 17:59)</a>:</h4>
<p>I know that tracing folk have said that they'd like to have better knobs for what <code>instrument</code> does/how it does it. For example, it doesn't work great for the playground's HTTP endpoints because I don't want to log the user's code but I do want to log every other parameter</p>



<a name="203670355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670355">(Jul 13 2020 at 01:26)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> for <code>-Z self-profile</code> we probably would want to integrate <code>tracing</code> in <code>rustc_data_structures::profiling</code> (which probably should just be <code>rustc_self_profiling</code> or something), and have that integration completely bypassed when using <code>-Z self-profile</code> without <code>tracing</code></p>



<a name="203670377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670377">(Jul 13 2020 at 01:26)</a>:</h4>
<p>that's because I expect logging (especially string formatting) to have an order of magnitude (or worse) overhead compared to <code>measureme</code>, and it would impact measurements</p>



<a name="203670384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670384">(Jul 13 2020 at 01:27)</a>:</h4>
<p>well yeah, it can be something on top</p>



<a name="203670387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670387">(Jul 13 2020 at 01:27)</a>:</h4>
<p>FWIW I did start <a href="https://github.com/rust-lang/measureme/pull/120">https://github.com/rust-lang/measureme/pull/120</a> though I didn’t benchmark it yet.</p>



<a name="203670389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670389">(Jul 13 2020 at 01:27)</a>:</h4>
<p>we already wrap the <code>measureme</code> API to handle a basic filtering function and whatnot so I think that's the best place to integrate it</p>



<a name="203670430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670430">(Jul 13 2020 at 01:28)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> hmm maybe I should hurry with my <code>rdpmc</code> integration, so we can actually measure that properly :P</p>



<a name="203670449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670449">(Jul 13 2020 at 01:28)</a>:</h4>
<p><code>measureme</code> is sadly too noisy atm due to using time, which as we all know, is a comfortable lie and nothing more,</p>



<a name="203670453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670453">(Jul 13 2020 at 01:28)</a>:</h4>
<p>ability to integrate the queries that we measure with random <code>#[instrument]</code> spans elsewhere in the codebase would be cool.</p>



<a name="203670468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670468">(Jul 13 2020 at 01:29)</a>:</h4>
<p>I definitely want <code>tracing</code> for getting a very in-depth view of what the compiler does and I'm willing to pay some extra cost for it, but maybe we can do stuff like sampling <code>rdpmc</code> before and after doing string formatting, to subtract that cost</p>



<a name="203670512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670512">(Jul 13 2020 at 01:30)</a>:</h4>
<p>if we can have our cake and measure it too, that'd be really useful</p>



<a name="203670521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670521">(Jul 13 2020 at 01:30)</a>:</h4>
<p>I think its plausible to avoid formatting at the tracing layer entirely (provided we don’t register the stdout/logging subscriber at all unless asked)</p>



<a name="203670533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670533">(Jul 13 2020 at 01:30)</a>:</h4>
<p>completely unrelatedly, I ran <code>cargo rustc -- -C llvm-args=-print-after-all</code> on a crate that takes 14 seconds to compile in non-incremental release mode</p>



<a name="203670560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670560">(Jul 13 2020 at 01:32)</a>:</h4>
<p>and it took almost <em>4 hours</em>, producing a 17 GB file, with just over <em>200 million</em> lines in it</p>



<a name="203670603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670603">(Jul 13 2020 at 01:32)</a>:</h4>
<p>(although it's possible <code>-Z no-parallel-llvm</code>, which you need for coherent output, was part of the slowdown)</p>



<a name="203670615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670615">(Jul 13 2020 at 01:32)</a>:</h4>
<p>wow.</p>



<a name="203670620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670620">(Jul 13 2020 at 01:33)</a>:</h4>
<p>the worst part is that the thing I wanted to find in there wasn't even clearly visible (there were two many differences other than the one I was looking for - yeah, I ran 2 builds of 4h each)</p>



<a name="203670631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670631">(Jul 13 2020 at 01:33)</a>:</h4>
<p>but it was only as an experiment / out of curiosity, having already found what I needed by modifying the source to only codegen one function (and its transitive callees)</p>



<a name="203670678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670678">(Jul 13 2020 at 01:34)</a>:</h4>
<p>anyway, all in all, I'm excited for our traceable future :D</p>



<a name="203670691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203670691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203670691">(Jul 13 2020 at 01:34)</a>:</h4>
<p>oh and maybe we can start replacing boring <code>debug!</code> calls with <code>#[instrument]</code></p>



<a name="203729218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203729218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> David Barsky <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203729218">(Jul 13 2020 at 15:25)</a>:</h4>
<p>I guess we should prioritize making the breaking change to <code>#[instrument]</code> where you need to _opt-in_ what parameters you want recorded, as opposed to opting out. i'll see how quickly we can get that supported and landed.</p>



<a name="203739333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203739333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nathan Whitaker <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203739333">(Jul 13 2020 at 16:51)</a>:</h4>
<p><span class="user-mention" data-user-id="198819">@David Barsky</span> Perhaps instead of making a breaking change there could be another keyword similar to skip, something like <code>#[instrument(only(a, b)]</code> to only record the listed parameters.</p>



<a name="203740164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203740164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> David Barsky <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203740164">(Jul 13 2020 at 16:57)</a>:</h4>
<p>Can you cut a ticket/suggestion about this on <a href="https://github.com/tokio-rs/tracing/issues">https://github.com/tokio-rs/tracing/issues</a>? it'd help us track that/prioritize it</p>



<a name="203740208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/203740208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> David Barsky <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#203740208">(Jul 13 2020 at 16:58)</a>:</h4>
<p>(i'm sorry, i've got to run to a work meeting now)</p>



<a name="204682798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Use%20%60tracing%60%20instead%20of%20%60log%60%20compiler-team%23331/near/204682798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> triagebot <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Use.20.60tracing.60.20instead.20of.20.60log.60.20compiler-team.23331.html#204682798">(Jul 22 2020 at 15:38)</a>:</h4>
<p>This proposal has been accepted: <a href="https://github.com/rust-lang/compiler-team/issues/331">#331</a>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>